<!doctype html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>评论详情</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/base.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/detail.css" />
</head>
<body>
<div class="detail">
    <if condition="$e_info['focus'] eq 0">
        <div class="attention">
            <div class="logo">
                <img src="__PUBLIC__/Wx/img/logo02.png"/>
                <h3>乡土味士</h3>
            </div>
            <i><input type="button" value="立即关注" class="gz"/></i>
        </div>
    </if>
    <div class="comment">
        <ul>
            <li>
                <div class="top">
                    <div class="pic"><img src="{$m_info.avatar}"/></div>
                    <h3>{$m_info.nickname}</h3><b>{$m_info.hometown}</b><time>{$e_info.addtime|date="Y-m-d",###}</time>
                </div>
                <div class="wz">
                    <p>{$e_info.content}</p>
                    <p class="number"><span><?=$e_info['like_num']?></span></p>
                    <p>
                        <volist name="e_info.pic" id="v">
                            <if condition="empty($v) neq true">
                                <img src="{$v}" />
                            </if>
                        </volist>
                    </p>
                </div>
            </li>
        </ul>
    </div>

    <div class="voice">
        <h2>全部评论(<b>{$count}</b>)</h2>
        <ul>
            <volist name="comment" id="vo">
                <li>
                    <div class="pic"><img src="{$vo.avatar}"/></div>
                    <div class="matter">
                        <h3>
                            <span>{$vo.nickname}</span><b>{$vo.hometown}</b>
                            <em class="praise" data-id="{$vo.id}" data-table="evaluate_comment">{$vo.like_num}</em>
                        </h3>
                        <p>{$vo.content}</p>
                        <h4><time>{$vo.addtime|date="Y-m-d",###}</time></h4>
                    </div>
                </li>
            </volist>
        </ul>
    </div>
    <!--评论成功到此页面出现-->
    <if condition="$e_info['is_me'] eq 'true'">
        <div class="button"><input type="button" value="分享好友，有机会免费获取恩施三日游"/></div>
        <else />
        <div class="button02"><span <if condition="$u_id neq $e_info.id"> class="left"</if> data-id="{$e_info.id}" data-table="foretaste_evaluate"><i>点赞</i></span><span class="right"><i>评论</i></span></div>
        <form action="/Wx/ForetasteEvaluate/addComment" method="post" class="js_form">
            <div class="apply" style="display:none;">
                <p>
                    <input type="text" placeholder="写评论" name="content" required/>
                    <input type="hidden" name="e_id" value="{$e_info.id}">
                    <input type="button" value="发表" onclick="sub()"/>
                </p>
            </div>
        </form>
    </if>
    <div class="page02">
        <div class="guide">
            <div class="pic"><img src="__PUBLIC__/Wx/img/share.png"/></div>
            <p>点击右上角，分享给朋友</p>
            <h5>邀请朋友一起来拼团！！！</h5>
            <h6><input type="button" value="我知道了" class="know"/></h6>
            <h4>关注后可查看订单详情</h4>
        </div>
    </div>
    <div class="page">
        <div class="close"></div>
        <div class="inner">
            <div class="pic"><img src="__PUBLIC__/Wx/images/pic14.jpg"/><p>长按图片【识别二维码】关注公众号</p></div>
            <div class="step">
                <h2>无法识别二维码</h2>
                <p>1.打开微信，点击“添加朋友”</p>
                <p>2.点击“公众号”</p>
                <p>3.搜索公众号：“乡土味士”</p>
                <p>4.点击：关注“，完成</p>
                <h5>精准扶贫 从我做起</h5>
            </div>
        </div>
    </div>
    <!--引用悬浮公共导航文件-->
    <include file="Public:nav" />

</div>
<script src="__PUBLIC__/Wx/js/jquery.js" ></script>
<script src="__PUBLIC__/js/jquery.form.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>

<script type="text/javascript">
    function sub() {
        if("{$e_info['focus']}" == 0){
            $('.page').css('display','block')
        }else{
            //表单提交
            $(".js_form").ajaxSubmit({
                //定义返回JSON数据，还包括xml和script格式
                dataType: 'json',
                success: function(data) {
                    //提交成功后调用
                    if(data.state==0) {
                        layer.msg(data.val, {icon:1,time:1000}, function(){
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data.info, {icon:2,time:1000});
                    }
                }
            });
        }//end if
    }//end fun



    $(".click span").click(function(){
        if($(this).text() ==="导航"){
            $(this).text("收起");
            $('.link02').css('display','block')
        }else{
            $(this).text("导航");
            $('.link02').css('display','none')
        }
    });//end fun


    $(".praise").toggle(

        function(){
            if("{$e_info['focus']}" == 0){
                $('.page').css('display','block')
            }else {
                var e_id = $(this).attr('data-id');
                var table = $(this).attr('data-table');
                var zan = $(this);
                var zan_num = zan.html();
                $.post('/Wx/ForetasteEvaluate/addLike', {e_id: e_id, table: table}, function (data) {
                    zan.addClass("praised");
                    if (table != 'foretaste_evaluate') {
                        zan.html(zan_num * 1 + 1)
                    }
                })
            }//end if
        },function() {
            if ("{$e_info['focus']}" == 0) {
                $('.page').css('display', 'block')
            } else {
                var e_id = $(this).attr('data-id');
                var table = $(this).attr('data-table');
                var zan = $(this);
                var zan_num = zan.html();
                $.post('/Wx/ForetasteEvaluate/cancleLike', {e_id: e_id, table: table}, function (data) {
                    zan.removeClass("praised");
                    if (table != 'foretaste_evaluate') {
                        zan.html(zan_num - 1)
                    }
                })
            }//end fun
        }//end if
    );//end toggle

    $(".left").toggle(
        function(){
            if("{$e_info['focus']}" == 0){
                $('.page').css('display','block')
            }else {
                var e_id = $(this).attr('data-id');
                var table = $(this).attr('data-table');
                var zan = $(this).children();
                var zan_this = $(".number").children();
                var zan_num = zan_this.html();
                $.post('/Wx/ForetasteEvaluate/addLike', {e_id: e_id, table: table}, function (data) {
                    zan.addClass("on");
                    zan.text("已赞")
                    zan_this.html(zan_num * 1 + 1)
                })
            }//end if
        },function() {
            if ("{$e_info['focus']}" == 0) {
                $('.page').css('display', 'block')
            } else {
                var e_id = $(this).attr('data-id');
                var table = $(this).attr('data-table');
                var zan = $(this).children();
                var zan_this = $(".number").children();
                var zan_num = zan_this.html();
                $.post('/Wx/ForetasteEvaluate/cancleLike', {e_id: e_id, table: table}, function (data) {
                    zan.removeClass("on");
                    zan.text("点赞");
                    zan_this.html(zan_num - 1)
                })
            }//end if
        }//end fun

    );//end toggle

    $('.gz').click(function(){
        $('.page').css('display','block')
    });
    $('.close').click(function(){
        $('.page').css('display','none')
    });
    $('.button input').click(function(){
        $('.page02').css('display','block')
    });
    $('.know').click(function(){
        $('.page02').css('display','none')
    });
    $('.right').click(function(){
        $('.apply').css('display','block')
    });
</script>
<include file="Public/share" title="{$e_info['goodstitle']}" desc="来乡土味士，吃天然菜，评选扶贫大使！" imgurl="{$m_info.avatar}" />
</body>
</html>